import {
	apiResquest
} from '@/utils/http.js'
import storage from '@/utils/storage'
// 设备列表
export const ListDevice = (params) => {
	let url = 'app/equipment/list'
	let userinfo = storage.getUserInfo()
	console.log(userinfo)
	if (userinfo.utype == 1) {
		url = 'app/equipment/getSbEquipmentList'
	}
	return apiResquest({
		url: url,
		method: 'get',
		data: params
	})
}
// 添加设备
export const AddDevice = (params) => {
	return apiResquest({
		url: 'app/equipment/insertSbEquipment',
		method: 'post',
		data: params
	})
}
// 修改设备 delFlag=2解除绑定 不传是修改
export const UpdateDevice = (params) => {
	if (!params) params = {}
	return apiResquest({
		url: 'app/equipment/updateSbEquipment',
		method: 'post',
		data: {
			delFlag: 0,
			...params
		}
	})
}
// 蓝牙数据
export const SendBlueTooth = (params) => {
	if (!params) params = {}
	return apiResquest({
		url: 'user/app/moni',
		method: 'post',
		data: params
	})
}
// 二级用户首页数据
export const IndexHistoryData = (params) => {
	if (!params) params = {}
	return apiResquest({
		url: 'app/equipment/getByDeviceId',
		method: 'get',
		data: params
	})
}
